package com.lantosec.hmrp.modules.warning.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.lantosec.hmrp.core.mvc.BaseEntity;
import com.lantosec.hmrp.modules.warning.vo.WarningMessageVO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;

/**
 * <p>
 * 预警信息 实体类
 * </p>
 *
 * @author AutoCode
 * @since 2020-05-20
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class WarningMessage extends BaseEntity<WarningMessageVO> {

    private static final long serialVersionUID = 1L;
    public WarningMessage(WarningMessageVO vo){
        this.ruleId = vo.getRuleId();
        this.dataMode = vo.getDataMode();
        this.smsTemplateId = vo.getSmsTemplateId();
        this.messageTemplate = vo.getMessageTemplate();
    }

    @Override
    public WarningMessageVO convertToVO(){
        return new WarningMessageVO(this);
    }


    /**
     * 预警规则ID
     */
    @TableId(value = "rule_id", type = IdType.ASSIGN_UUID)
    private String ruleId;

    /**
     * 数据方式(1公共2部门3个人)
     */
    private Integer dataMode;

    /**
     * 短信通知模板ID
     */
    private Integer smsTemplateId;

    /**
     * 信息模板内容
     */
    private String messageTemplate;

    @TableField(exist = false)
    private Integer flag;


    public enum ColName {
        rule_id, data_mode, sms_template_id, message_template, 
    }
}
